/*
 *  EventLib
 *  qEntity.h
 *
 *	Copyright (c) 2001, AVS
 *	All rights reserved.
 *
 *	Redistribution and use in source and binary forms, with or without
 *	modification, are permitted provided that the following conditions are met:
 *	1.	Redistributions of source code must retain the above copyright
 *		notice, this list of conditions and the following disclaimer.
 *	2.	Redistributions in binary form must reproduce the above copyright
 *		notice, this list of conditions and the following disclaimer in the
 *		documentation and/or other materials provided with the distribution.
 *	3.	All advertising materials mentioning features or use of this software
 *		must display the following acknowledgement:
 *		This product includes software developed by the AVS.
 *	4.	Neither the name of the AVS nor the
 *		names of its contributors may be used to endorse or promote products
 *		derived from this software without specific prior written permission.
 *
 *	THIS SOFTWARE IS PROVIDED BY AVS ''AS IS'' AND ANY
 *	EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 *	WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 *	DISCLAIMED. IN NO EVENT SHALL AVS BE LIABLE FOR ANY
 *	DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 *	(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *	ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *	(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */


#ifndef _qEntity_h
#define _qEntity_h

#include "EventLib.h"


class qEntity : public qComponent
{
public:
	qEntity();
	qEntity(qComponent *comp);
	~qEntity();
	void print() { printf("qEntity saying hello.\n"); }
	
	float getX() { return this->x; }
	float getY() { return this->y; }
	
	void setX(float _x) { this->x = _x; }
	void setY(float _y) { this->y = _y; }
	
	void become(void *ptr);
	void becomeC(qComponent *ptr);
	
	static qEntity *cast_to_me(void *ptr);
	
	void REGISTER_SCRIPTABLES(qScriptEngine *engine)
	{
		REGISTER_CLASS(engine, "qEntity", qEntity);
		
		REGISTER_METHOD(engine, "qEntity", qEntity, "void print()", print);
		
		REGISTER_METHOD(engine, "qEntity", qEntity, "float getX()", getX);
		REGISTER_METHOD(engine, "qEntity", qEntity, "float getY()", getY);
		REGISTER_METHOD(engine, "qEntity", qEntity, "void setX(float _x)", setX);
		REGISTER_METHOD(engine, "qEntity", qEntity, "void setY(float _y)", setY);
		
	//	REGISTER_METHOD(engine, "qEntity", qEntity, "void become(?&ptr)", become);
		REGISTER_METHOD(engine, "qEntity", qEntity, "void becomeC(qComponent @ptr)", becomeC);
		
		//r = engine->RegisterObjectMethod("any", "void store(?&in)", asMETHODPR(CScriptAny,Store,(void*,int),void), asCALL_THISCALL); assert( r >= 0 );
		
		//engine->getEngine()->RegisterObjectMethod("qEntity", "void become(?&in)", asMETHODPR(qEntity,become,(void*),void), asCALL_THISCALL);
		
		//REGISTER_METHOD(engine, "err", err, "string &get_err()", get_err);
		
		//REGISTER_GLOBAL_PROPERTY(engine, "float mx", &this->x);
		//REGISTER_GLOBAL_PROPERTY(engine, "float mx", &this->y);
	}
	
private:
	float x;
	float y;
};

#endif